package com.example.aigc_education.enums;

import lombok.Getter;

@Getter
public enum UrlType {

    LINK("link", 0),
    FILE("file", 1);

    private final String title;

    private final Integer value;

    UrlType(String title, Integer value) {
        this.title = title;
        this.value = value;
    }

    public static UrlType fromValue(Integer value) {
        for (UrlType urlType : UrlType.values()) {
            if (urlType.getValue().equals(value)) {
                return urlType;
            }
        }
        return null;
    }

    public static UrlType fromTitle(String title) {
        for (UrlType urlType : UrlType.values()) {
            if (urlType.getTitle().equals(title)) {
                return urlType;
            }
        }
        return null;
    }
}
